package polymorphism;

/**
 * @author yuisama
 * @date 2022/09/14 20:11
 **/
class B {
    public B() {
        func();
    }

    public void test() {
        func();
    }

    public void func() {
        System.out.println("B的func方法");
    }
}
public class D extends B{
    private int num = 1;
    public void func() {
        System.out.println("D的func方法，num = " + num);
    }
    public static void main(String[] args) {
        D d = new D();
        d.test();
    }
}